﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AMS.Configuration
{
    /// <summary>
    /// 列信息
    /// </summary>
    public class ColumnInfo
    {
        public ColumnInfo()
        {
            HAlign = HorizenAlignment.Left;
        }

        public ColumnInfo(string name)
            :this()
        {
            Name = name;
        }

        /// <summary>
        /// 列名
        /// </summary>
        public virtual string Name { get; set; }

        /// <summary>
        /// 标题名
        /// </summary>
        public virtual string Caption { get; set; }

        /// <summary>
        /// 对应的数字字典
        /// </summary>
        public virtual int DictKey { get; set; }

        /// <summary>
        /// 是否显示列
        /// </summary>
        public virtual bool IsDisplayColumn { get; set; }

        /// <summary>
        /// 列宽
        /// </summary>
        public virtual int Width { get; set; }

        /// <summary>
        /// 水平方向的对齐
        /// </summary>
        public virtual HorizenAlignment HAlign { get; set; }

        internal ColumnInfoCollection container;
        /// <summary>
        /// 宿主,斩未使用
        /// </summary>
        protected internal ColumnInfoCollection Container
        {
            get { return container; }
        }

        /// <summary>
        /// 位于容器中的序号，斩未使用
        /// </summary>
        public int Index
        {
            get
            {
                if (container == null)
                {
                    return -1;
                }

                return container.IndexOf(this);
            }
        }
    }
}
